<template>
  <div>
    <el-dialog
        title="客户来源"
        :visible.sync="dialogVisible"
        width="965px">

        <div label="客户信息备注" name="first">
          <el-form :inline="true" ref="informationForm" :model="informationForm" label-width="100px" class="demo-form-inline">
            <el-form-item label="客户姓名">
              <el-input v-model="informationForm.name"></el-input>
            </el-form-item>
            <el-form-item label="电话" class="line">
              <el-input v-model="informationForm.iphone"></el-input>
            </el-form-item>
            <el-form-item label="下单手机型号">
              <el-input v-model="informationForm.modelIphone"></el-input>
            </el-form-item>
            <el-form-item label="身份证后四位">
              <el-input v-model="informationForm.idFour"></el-input>
            </el-form-item>
            <el-form-item label="工作年限">
              <el-input v-model="informationForm.workyear"></el-input>
            </el-form-item>
            <el-form-item label="工作单位">
              <el-input v-model="informationForm.workUnit"></el-input>
            </el-form-item>
            <el-form-item label="社保">
              <el-input v-model="informationForm.social"></el-input>
            </el-form-item>
            <el-form-item label="公积金">
              <el-input v-model="informationForm.accumulation"></el-input>
            </el-form-item>
            <el-form-item label="月收入">
              <el-input v-model="informationForm.monthly"></el-input>
            </el-form-item>
            <el-form-item label="收货地址">
              <el-input v-model="informationForm.IncomeAddress"></el-input>
            </el-form-item>
            <el-form-item label="住址">
              <el-input v-model="informationForm.address"></el-input>
            </el-form-item>
            <el-form-item label="公司">
              <el-input v-model="informationForm.company"></el-input>
            </el-form-item>
            <el-form-item label="资产证明">
              <el-input v-model="informationForm.certification"></el-input>
            </el-form-item>
            <el-form-item label="在租情况">
              <el-input v-model="informationForm.RentSituation"></el-input>
            </el-form-item>
            <el-form-item label="婚姻状况">
              <el-input v-model="informationForm.maritalStatus"></el-input>
            </el-form-item>
            <el-form-item label="学历">
              <el-input v-model="informationForm.education"></el-input>
            </el-form-item>
            <el-form-item label="芝麻分">
              <el-input v-model="informationForm.zhiMaScore"></el-input>
            </el-form-item>
            <el-form-item label="紧急联系人">
              <el-input v-model="informationForm.emergency"></el-input>
            </el-form-item>
            <el-form-item label="备注">
              <el-input
                  type="textarea"
                  :rows="4"
                  v-model="informationForm.remark"></el-input>
            </el-form-item>
            <div style="text-align: center">
              <el-button @click="dialogVisible = false">取消</el-button>
              <el-button type="primary" @click="ensure">保存</el-button>
            </div>
          </el-form>
        </div>



    </el-dialog>
  </div>
</template>

<script>
import {customerInformations,selectFkMessage} from '@/api/order'
import {getHuabeiSettleData} from "../api/finance";
export default {
  props:{
    personMessage:{
      type:Object
    },
    riskMessage:{
      type:Object
    }
  },
  data(){
    return{
      activeTab:'first',
      risk_list_check:'',
      personal_loan_s:'',
      personal_overdue_history:'',
      relevance_risk_check:'',
      dialogVisible: false,
      dataList:[],
      informationForm: {
        name: '',
        iphone: '',
        modelIphone: '',
        idFour: '',
        workUnit: '',
        social: '',
        accumulation:'',
        monthly:'',
        IncomeAddress:'',
        address:'',
        company:'',
        workyear:'',
        certification:'',
        RentSituation:'',
        maritalStatus:'',
        education:'',
        zhiMaScore:'',
        emergency:'',
        remark:''
      },
      strategy_data:null,
      information:{
        score:'',
        suggest:'',
        HitTheRisk:'',
        scoreShows:'',
        suggestMoney:''
      },
      PhoneInformation:{
        identity_two_elements:'',
        network_triple_elements:'',
        time_online:''
      },
      people: {
        name: '',
        idcard: '',
        iphone: '',
        age:'',
        home:'',
        iphonefrom:'',
        goods_type:'',
        status:'',
        total_rent:'',
        total_periods:'',
        price:'',
        gender:''
      },
      courtrisk:[],
      overdue:[],
      history:{
        payCount:'',
        loansCount:'',
        endApply:'',
        recentApp:''
      },
      monthcount:{
        time:'',
        oneMon:'',
        thirdMon:'',
        sixMon:'',
        tweMon:''
      },
      institution:{
        cflenders:'',
        nllenders:'',
        lend_time:'',
        lend_time_distance:''
      },
      monthsdata:{
        time:'',
        oneMon:'',
        threeMon:'',
        sixMon:'',
        lenders: '',
        lend_number12:'',
        lend_number24:''
      },
      lend_money:{
        MoneyTime:'',
        lend_money1:'',
        lend_money3:'',
        lend_money6:'',
        lend_money12:'',
        lend_money24:''
      },
      PerformanceException:{
        timeses:'',
        repay_succ1:'',
        repay_succ3:'',
        repay_succ6:'',
        repay_succ12:'',
        repay_succ24:'',
        count:'',
        repay_fail1:'',
        repay_fail3:'',
        repay_fail6:'',
        repay_fail12:'',
        repay_fail24:'',
      },
      PerformanceMoney:{
        Money:'',
        repay_money1:'',
        repay_money3:'',
        repay_money6:'',
        repay_money12:'',
        repay_money24:'',
      },
      rent_history:{
        apply_time:'',
        d7_apply_time:'',
        m1_apply_time:'',
        m3_apply_time:'',
        m6_apply_time:'',
        m12_apply_time:'',
        agency_time:'',
        d7_apply_agency_time:'',
        m1_apply_agency_time:'',
        m3_apply_agency_time:'',
        m6_apply_agency_time:'',
        m12_apply_agency_time:''
      },
      CreditPlatform:{
        time:'',
        platform:'',
        xincard:'',
        bigpay:'',
        orpay:'',
        p2form:'',
        smpay:'',
        sum:''
      },
      nintydays:{
        time:'',
        platform:'',
        xincard:'',
        bigpay:'',
        orpay:'',
        p2form:'',
        smpay:'',
        sum:''
      },
      Thirtydays:{
        time:'',
        platform:'',
        xincard:'',
        bigpay:'',
        orpay:'',
        p2form:'',
        smpay:'',
        sum:''
      },

    }
  },
  watch:{
    dialogVisible(val) {

      this.clear()
      this.activeTab = 'first'
      if (val) {
        if ( isNaN(this.personMessage.oid)){
          this.informationForm.orderId = this.personMessage.order_id;
          this.informationForm.iphone = this.personMessage.phone_number;
          this.informationForm.name = this.personMessage.name;
          this.informationForm.modelIphone = this.personMessage.phone_model;
          this.informationForm.idFour = this.personMessage.id_card_four;
          this.informationForm.workUnit = this.personMessage.work_unit;
          this.informationForm.workyear = this.personMessage.work_year;
          this.informationForm.accumulation = this.personMessage.accumulation;
          this.informationForm.monthly = this.personMessage.monthly;
          this.informationForm.IncomeAddress = this.personMessage.income_address;
          this.informationForm.address = this.personMessage.address;
          this.informationForm.company = this.personMessage.company;
          this.informationForm.education = this.personMessage.education;
          this.informationForm.maritalStatus = this.personMessage.marital_status;
          this.informationForm.RentSituation = this.personMessage.rent_situation;
          this.informationForm.zhiMaScore = this.personMessage.zhima_score;
          this.informationForm.emergency = this.personMessage.emergency;
          this.informationForm.remark = this.personMessage.remark;
          this.informationForm.social = this.personMessage.social;
          this.informationForm.certification = this.personMessage.certification;
        }else{
          this.informationForm.orderId = this.personMessage.oid;
        }
      }
    }

  },
  methods:{
    clear() {
      this.informationForm = {
        name: '',
        iphone: '',
        modelIphone: '',
        idFour: '',
        workUnit: '',
        social: '',
        accumulation: '',
        monthly: '',
        IncomeAddress: '',
        address: '',
        company: '',
        workyear: '',
        certification: '',
        RentSituation: '',
        maritalStatus: '',
        education: '',
        zhiMaScore: '',
        emergency: '',
        remark: ''
      }
    },


    ensure(){
     this.$refs['informationForm'].validate((res) =>{
       if (res){
         let param={};
         param.orderId =  this.informationForm.orderId;
        param.name= this.informationForm.name;
         param.iphone= this.informationForm.iphone;
         param.modelIphone= this.informationForm.modelIphone;
         param.idFour= this.informationForm.idFour;
         param.workUnit= this.informationForm.workUnit;
         param.social=  this.informationForm.social;
         param.accumulation= this.informationForm.accumulation;
         param.monthly= this.informationForm.monthly;
         param.IncomeAddress= this.informationForm.IncomeAddress;
         param.address= this.informationForm.address;
         param.company= this.informationForm.company;
         param.workyear= this.informationForm.workyear;
         param.certification= this.informationForm.certification;
         param.RentSituation=  this.informationForm.RentSituation;
         param.maritalStatus= this.informationForm.maritalStatus;
         param.education= this.informationForm.education;
         param.zhiMaScore= this.informationForm.zhiMaScore;
         param.emergency= this.informationForm.emergency;
         param.remark= this.informationForm.remark;
         customerInformations(param).then(res =>{

           this.$message.success('保存成功');
           this.dialogVisible = false;

         })
         // let param = this.informationForm.name;
         // console.log(param);
       }
       else {
         this.$message.error('备注信息不能全部为空');
         return false;
       }


     })

    },

    // callOff(){
    //   this.dialogVisible = false;
    //   this.informationForm = {};
    // }
  }


}
</script>

<style scoped>

</style>